import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../views/Home.vue';

Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        redirect: '/Home',
    },
    {
        path: '/Home/:Configuration',
        name: 'Home',
        component: Home,
    },
    {
        path: '/ChartLayout/:Configuration',
        name: 'ChartLayout',
        component: () => import( '../views/ChartLayout/index.vue'),
    },
    {
        path: '/demo1',
        name: 'demo1',
        component: () => import('../views/demo/demo1.vue'),
    },
    {
        path: '/demo2',
        name: 'demo2',
        component: () => import('../views/demo/demo2.vue'),
    },
];

const router = new VueRouter({
    routes,
});
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};

export default router;
